package com.heima.article.controller.v1;

import com.heima.apis.article.ApArticleControllerApi;
import com.heima.article.mapper.ApArticleMapper;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xiaosiqi
 * @date 2021/8/13 23:12
 */
@RestController
@RequestMapping("/api/v1/article")
public class ApArticleController implements ApArticleControllerApi {

    @Autowired
    ApArticleMapper apArticleMapper;
    /**
     * 保存app文章
     *
     * @param apArticle
     * @return
     */
    @Override
    @PostMapping("/save")
    public ResponseResult saveArticle(@RequestBody ApArticle apArticle) {
        apArticleMapper.insert(apArticle);
        return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    }
}
